package StudyCode.summary.mycollection;

import java.util.HashSet;
import java.util.Set;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ReturnsTheIntersectionOfTwoSetsWithoutModifyingTheOriginalSets {
	public static <A> Set<A> intersection(Set<A> first, Set<A> second) {

		HashSet<A> result = new HashSet<A>(first);
		result.retainAll(second);
		return result;
	}
}
